/*
 * @lc app=leetcode.cn id=1893 lang=javascript
 *
 * [1893] 检查是否区域内所有整数都被覆盖
 */

// @lc code=start
/**
 * @param {number[][]} ranges
 * @param {number} left
 * @param {number} right
 * @return {boolean}
 */
var isCovered = function (ranges, left, right) {
  const arr = [];
  for (let i = left; i <= right; i++) {
    arr[i] = false;
  }
  ranges.forEach(([s, e]) => {
    for (let i = s; i <= e; i++) {
      arr[i] = true;
    }
  })
  let res = true;
  for (let i = left; i <= right; i++) {
    res = res && arr[i];
    if (!res) return false;
  }
  return true;
};
// @lc code=end

